package Supermercado;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.microedition.global.ResourceException;


public class Configuracion {

	private String ip;
	private String puerto;
	private String usuario;
	private String password;
	private String rutaFile;
	
	/*
	 * public class Punto2D {
			int x;
			int y;
			String etiqueta;
			public void serialize(OutputStream out) throws IOException {
					DataOutputStream dos = new DataOutputStream( out );
					dos.writeInt(x);
					dos.writeInt(y);
					dos.writeUTF(etiqueta);
					dos.flush();
				}
			public static Punto2D deserialize(InputStream in) throws IOException {
					DataInputStream dis = new DataInputStream( in );
					Punto2D p = new Punto2D();
					p.x = dis.readInt();
					p.y = dis.readInt();
					p.etiqueta = dis.readUTF();
					return p;
			}
		}
*/
	
	
	public Configuracion() {
		super();
	}

	public Configuracion(String ip, String puerto, String usuario,
			String password, String rutaFile) {
		super();
		this.ip = ip;
		this.puerto = puerto;
		this.usuario = usuario;
		this.password = password;
		this.rutaFile = rutaFile;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getPuerto() {
		return puerto;
	}

	public void setPuerto(String puerto) {
		this.puerto = puerto;
	}

	public String getUsuario() {
		return usuario;
	}

	public void setUsuario(String usuario) {
		this.usuario = usuario;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getRutaFile() {
		return rutaFile;
	}

	public void setRutaFile(String rutaFile) {
		this.rutaFile = rutaFile;
	}

	public Object clone() {
		// TODO Auto-generated method stub
		return null;
	}

	public Configuracion readConeccion(InputStream in) throws IOException, ResourceException {
		DataInputStream dis = new DataInputStream( in );
		Configuracion c = new Configuracion();
		c.ip = dis.readUTF();
		c.puerto = dis.readUTF();
		c.rutaFile = dis.readUTF();
		c.usuario = dis.readUTF();
		c.password = dis.readUTF();
		return c;
	}

	public void writeConeccion(OutputStream out) throws IOException, ResourceException {
		DataOutputStream dos = new DataOutputStream( out );
		dos.writeUTF(this.ip);
		dos.writeUTF(this.puerto);
		dos.writeUTF(this.rutaFile);
		dos.writeUTF(this.usuario);
		dos.writeUTF(this.password);
		dos.flush();
	}	

	
}
